﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WxTenpay.Core.Model
{

    /// <summary>
    /// job 任务
    /// </summary>
   public class JobTaskEntity
    {


        public string GuId { set; get; } = "";
        /// <summary>
        /// 作业名称
        /// </summary>
        public string TaskName { get; set; } = "";
        /// <summary>
        /// 分组
        /// </summary>
        public string GroupName { get; set; } = "";
        /// <summary>
        /// 间隔(Cron)
        /// </summary>
        public string Interval { get; set; } = "";
        /// <summary>
        /// 远程调用接口Url
        /// </summary>
        public string ApiUrl { get; set; } = "";
        /// <summary>
        /// 请求header验证的Key
        /// </summary>
        public string AuthKey { get; set; } = "";
        /// <summary>
        /// 请求header验证的value
        /// </summary>
        public string AuthValue { get; set; } = "";
        /// <summary>
        /// 描述
        /// </summary>
        public string Describe { get; set; } = "";
        /// <summary>
        /// 请求方式
        /// </summary>
        public string RequestType { get; set; } = "";
        /// <summary>
        ///  最后执行时间
        /// </summary>
        public DateTime? LastRunTime { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        public string CreateTime { get; set; } = "";

        /// <summary>
        /// 状态 0：正常 1：暂停  2：完成 3：异常  4：阻塞 5：停止 
        /// </summary>
        public int Status { get; set; } = 0;
        public void Create()
        {
            if (string.IsNullOrWhiteSpace(this.GuId))
                this.GuId = Guid.NewGuid().ToString();
            if (string.IsNullOrWhiteSpace(this.CreateTime))
                this.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }

    }
}
